HELP - Error Code: 2100 and message: "Not Found"

Hello All,

I am trying to trigger an alert using nodejs/pdjs and hitting the Events API v2 endpoint but keep getting back this error message

status 200 OK
{
    "error": {
        "message": "Not Found",
        "code": 2100
    }
}

Below is what I am doing, please correct me if I am using the api the wrong way.

HTTP-Method: POST
const alertUrl = https://events.pagerduty.com/v2/enqueue
header

{
    'Content-Type': 'application/json',
    'Accept': 'application/vnd.pagerduty+json;version=2',
    'Authorization': 'Token token=<MY_API_USER_TOKEN>',
    'From': <MY_EMAIL>
}

body:

{
            payload: {
                summary: 'This is a test alert,
                timestamps: '2015-07-17T08:42:58.315+0000',
                severity: 'warning',
                source: 'sample source test local environment',
                component: 'mysql',
                group: 'prod-datapipe',
                class: 'disk',
                custom_details: {
                    'free space': '1%',
                    'ping time': '1500ms',
                    'load avg': 0.75,
                },
            },
            routing_key: <MY_INTEGREATION_KEY>,
            dedup_key: 'srv01/mysql',
            event_action: 'trigger',
            client: 'Sample Monitoring Service',
            client_url: 'https://monitoring.service.com',
            links: [
                {
                    href: 'http://pagerduty.example.com',
                    text: 'An example link.',
                },
            ],
            images: [
                {
                    src: 'https://chart.googleapis.com/chart?chs=600x400&chd=t:6,2,9,5,2,5,7,4,8,2,1&cht=lc&chds=a&chxt=y&chm=D,0033FF,0,0,5,1',
                    href: 'https://google.com',
                    alt: 'An example link with an image',
                },
            ],
        }

sample code:

import { api } from '@pagerduty/pdjs';

const pd = api({ token: <MY_API_KEY>, tokenType: 'bearer' });

async someFunction() {
  const { response, data, next, resource } = await pd.post(alertUrl, { headers, data: body });
  return data;
}

someFunction() // returns => error code 2100 with message not found

I am trying to run the above function in a NestJs application, oddly when I try to run the above function using postman or curl; it works.

Hi Alvin,

Thanks for reaching out!

Looking at the API documentation page for Send an event to PagerDuty, one thing I’m noticing is the keys in the body below do not have quotation marks around them.

In addition, payload.summary appears to be missing an ending quotation mark.

My recommendation is to review the documentation page for this and ensure that what you have set up matches the format expected. You can also send test API requests from the documentation page to make sure it works correctly.

Feel free to reach out if there are any issues and we can investigate further!

Best,